Sub AutoGenIdxMenuTbl()
    On Error GoTo Tuichu
    Dim i As Integer
    Dim ShtCount As Integer
    Dim ShtRowNum As Integer
    Dim sht As Object
    Dim SelectionCell As Range
    ShtCount = Worksheets.Count
    If ShtCount = 0 Or ShtCount = 1 Then Exit Sub
    Application.ScreenUpdating = False
    ' "数据汇总信息"表放在最前面
    For i = 1 To ShtCount
        If Sheets(i).Name = "数据汇总信息" Then
            Sheets("数据汇总信息").Move Before:=Sheets(1)
        End If
    Next i
    
    '不存在"数据汇总信息"页，在最前面加入sheet="数据汇总信息"
    If Sheets(1).Name <> "数据汇总信息" Then
        ShtCount = ShtCount + 1
        Sheets(1).Select
        Sheets.Add
        Sheets(1).Name = "数据汇总信息"
    End If
        
    Sheets("数据汇总信息").Select
    Columns("A:E").Delete Shift:=xlToLeft
    Application.StatusBar = "正在生成数据汇总信息…………请等待！"

    '加表头
    Sheets("数据汇总信息").Select
	ActiveSheet.Range("A1:E1").merge
    ActiveSheet.Range("A1").Value = "数据汇总信息"
    ActiveSheet.Range("A2").Value = "序号"
    ActiveSheet.Range("B2").Value = "表名称"
    ActiveSheet.Range("C2").Value = "对应sheet"
    ActiveSheet.Range("D2").Value = "数据项"
    ActiveSheet.Range("E2").Value = "数据类型（系统生成、手工录入）"
    Set SelectionCell = Worksheets("数据汇总信息").Range("A1")
    With SelectionCell
        .HorizontalAlignment = xlDistributed
        .VerticalAlignment = xlCenter
        .AddIndent = True
        .Font.Bold = True
        .Interior.ColorIndex = 34
    End With
    
    '填写表内容
    For i = 2 To ShtCount
        Worksheets("数据汇总信息").Cells(i + 1, 1) = i - 1
        Worksheets("数据汇总信息").Cells(i + 1, 2) = Sheets(i).Range("A1")
		'Worksheets("数据汇总信息").Cells(i + 1, 2) = Sheets(i).Name
        ActiveSheet.Hyperlinks.Add Anchor:=Worksheets("数据汇总信息").Cells(i + 1, 3), Address:="", SubAddress:= _
        Sheets(i).Name & "!R1C1", TextToDisplay:=Sheets(i).Name
        ShtRowNum = WorksheetFunction.CountA(Sheets(i).Columns("a:a")) - 2 '去掉2行表头
        Worksheets("数据汇总信息").Cells(i + 1, 4) = ShtRowNum
		Worksheets("数据汇总信息").Cells(i + 1, 5) = "系统生成"
    Next

    '调整格式
    Columns("A:E").AutoFit
	Columns("A:A").HorizontalAlignment = xlCenter
    Application.StatusBar = False
    Application.ScreenUpdating = True
    
Tuichu:
End Sub







